package edu.ucsur.tp.contactcenter.forms;

import java.awt.EventQueue;
import java.beans.PropertyVetoException;
import java.util.List;

import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JCheckBox;

import edu.ucsur.tp.negocio.mantenimientos.UsuarioNego;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import org.eclipse.wb.swing.FocusTraversalOnArray;
import java.awt.Component;

public class FrmUsuariosRegistro extends JInternalFrame {
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private JTextField textField_6;

	private UsuarioNego usuarioNegocio = new UsuarioNego();
	
	public int modo = 1;
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					FrmUsuariosRegistro frame = new FrmUsuariosRegistro();
					frame.setVisible(true);
					frame.moveToFront();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	
	/**
	 * Create the frame.
	 */
	public FrmUsuariosRegistro() {
		setClosable(true);
		setFrameIcon(new ImageIcon(FrmUsuariosRegistro.class.getResource("/edu/ucsur/tp/contactcenter/images/Businessman.png")));
		try {
			setIcon(true);
		} catch (PropertyVetoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setTitle("Registro de Usuarios");
		setBounds(100, 100, 373, 322);
		getContentPane().setLayout(null);
		
		JButton cmdSalir = new JButton("");
		cmdSalir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				setVisible(false);
			}
		});
		cmdSalir.setIcon(new ImageIcon(FrmUsuariosRegistro.class.getResource("/edu/ucsur/tp/contactcenter/images/cancel.png")));
		cmdSalir.setBounds(311, 245, 39, 40);
		getContentPane().add(cmdSalir);
		
		JButton cmdGuardar = new JButton("");
		cmdGuardar.setIcon(new ImageIcon(FrmUsuariosRegistro.class.getResource("/edu/ucsur/tp/contactcenter/images/guardar.png")));
		cmdGuardar.setBounds(272, 245, 39, 40);
		getContentPane().add(cmdGuardar);
		
		JLabel lblNewLabel = new JLabel("Nombres");
		lblNewLabel.setBounds(26, 52, 129, 14);
		getContentPane().add(lblNewLabel);
		
		JLabel label = new JLabel("Id Usuario");
		label.setBounds(26, 24, 129, 14);
		getContentPane().add(label);
		
		JLabel lblApellidos = new JLabel("Apellidos");
		lblApellidos.setBounds(26, 80, 129, 14);
		getContentPane().add(lblApellidos);
		
		JLabel lblCorreo = new JLabel("Correo");
		lblCorreo.setBounds(26, 108, 129, 14);
		getContentPane().add(lblCorreo);
		
		JLabel lblFecNaci = new JLabel("Fec. Naci.");
		lblFecNaci.setBounds(26, 136, 129, 14);
		getContentPane().add(lblFecNaci);
		
		textField = new JTextField();
		textField.setBounds(98, 21, 200, 20);
		getContentPane().add(textField);
		textField.setColumns(10);
		
		textField_1 = new JTextField();
		textField_1.setColumns(10);
		textField_1.setBounds(98, 49, 200, 20);
		getContentPane().add(textField_1);
		
		textField_2 = new JTextField();
		textField_2.setColumns(10);
		textField_2.setBounds(98, 77, 200, 20);
		getContentPane().add(textField_2);
		
		textField_3 = new JTextField();
		textField_3.setColumns(10);
		textField_3.setBounds(98, 105, 200, 20);
		getContentPane().add(textField_3);
		
		textField_4 = new JTextField();
		textField_4.setColumns(10);
		textField_4.setBounds(98, 133, 103, 20);
		getContentPane().add(textField_4);
		
		textField_5 = new JTextField();
		textField_5.setColumns(10);
		textField_5.setBounds(98, 192, 120, 20);
		getContentPane().add(textField_5);
		
		textField_6 = new JTextField();
		textField_6.setColumns(10);
		textField_6.setBounds(228, 192, 120, 20);
		getContentPane().add(textField_6);
		
		JLabel lblContrasea = new JLabel("Contrase\u00F1a");
		lblContrasea.setBounds(26, 195, 129, 14);
		getContentPane().add(lblContrasea);
		
		JLabel lblDdmmyyyy = new JLabel("dd/MM/yyyy");
		lblDdmmyyyy.setBounds(211, 136, 129, 14);
		getContentPane().add(lblDdmmyyyy);
		
		JComboBox cbPerfil = new JComboBox();
		cbPerfil.setBounds(98, 161, 200, 20);
		getContentPane().add(cbPerfil);
		
		List<String> listaPerfil = 
				usuarioNegocio.listaPerfiles();
		for (String it : listaPerfil) {
			cbPerfil.addItem(it);
		}
		
		JLabel lblPerfil = new JLabel("Perfil");
		lblPerfil.setBounds(26, 164, 129, 14);
		getContentPane().add(lblPerfil);
		
		JCheckBox chckbxNewCheckBox = new JCheckBox("Usuario Activo");
		chckbxNewCheckBox.setBounds(24, 231, 97, 23);
		getContentPane().add(chckbxNewCheckBox);
		setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{getContentPane(), cmdSalir, cmdGuardar, lblNewLabel, label, lblApellidos, lblCorreo, lblFecNaci, textField, textField_1, textField_2, textField_3, textField_4, textField_5, textField_6, lblContrasea, lblDdmmyyyy, cbPerfil, lblPerfil, chckbxNewCheckBox}));

	}
}
